package com.liurong.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.liurong.dao.UserMapper;
import com.liurong.domain.SysUser;
import com.liurong.service.UserService;

@Service
public class UserServiceImpl implements UserService {
	@Autowired
	private UserMapper userMapper;

	public List<SysUser> queryUser(SysUser user) {
		return this.userMapper.queryUser(user);
	}

	public SysUser queryUserForOne(String username) {
		return this.userMapper.queryUserForOne(username);
	}

	@Transactional("transactionManager")
	// 异常回滚需要指定是哪一个数据源事务管理
	public int addUser(SysUser user) {
		int flag = this.userMapper.addUser(user);
		System.out.println(1 / 0);
		return flag;
	}
}
